<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{block name="title"}{/block}</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <!--weui.min.css-->
    {css href="/static/wechat/jquery_weui/lib/weui.min.css" /}
    <!--jquery-weui.min.css-->
    {css href="/static/wechat/jquery_weui/css/jquery-weui.min.css" /}

    <link rel="stylesheet" type="text/css" href="/static/wechat/css/common.css?v={php}echo time(){/php}" />
    <link rel="stylesheet" type="text/css" href="/static/wechat/css/base.css?v={php}echo time(){/php}" />
    {css href="/static/wechat/css/font.css" /}
    {css href="/static/wechat/css/certification.css" /}
</head>
<body>
<div class="pageControl orderDetails" style="padding-bottom: 1.5rem;">
    <div class="msui_nav msui_navTop" style="border-bottom: 1px solid #cccccc;">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">合伙人认证</h1>
    </div>
    <span class="g-sfmsg">身份信息</span>
    <ul class="g-ul-ipt">
        <li class="g-li">
            <div class="g-leb-div"><label>姓名</label></div>
            <div class="g-ipt-div"><input placeholder="请输入您身份证上的的姓名"/></div>
        </li>
        <li class="g-li gsolid">
            <div class="g-leb-div"><label>身份证</label></div>
            <div class="g-ipt-div"><input placeholder="请输入您的身份证号"/></div>
        </li>
    </ul>
    <span class="g-sfmsg">身份证照片</span>
    <!--上传身份证照片-->
    <div class="g-scsfz-div">
        <div class="scsfz">
            <i class="sczmsfz">
                <div class="weui-uploader__input-box scsfz3">
                    <input id="uploaderInput1" class="weui-uploader__input" type="file" accept="image/*"  file-attr="" />
                    <input type="hidden" name="id_card_in_hand" value="" />
                </div>
            </i>
            <p>手持身份证正面照片</p>
        </div>

        <div class="scsfz">
            <i class="zmsfz">
                <div class="weui-uploader__input-box scsfz3">
                    <input id="uploaderInput2" class="weui-uploader__input" type="file" accept="image/*" file-attr="" />
                    <input type="hidden" name="id_card_front" value="" />
                </div>
            </i>
            <p>身份证正面照片</p>
        </div>

        <div class="scsfz" style="margin-top: -1rem;">
            <i class="sfzfm">
                <div class="weui-uploader__input-box scsfz3">
                    <input id="uploaderInput3" class="weui-uploader__input" type="file" accept="image/*" file-attr="" />
                    <input type="hidden" name="id_card_verso" value="" />
                </div>
            </i>
            <p>身份证反面照片</p>
        </div>
    </div>
    <!--意向区域-->
    <span class="g-sfmsg">意向区域</span>

    <div class="weui-cells">
        <i class="weui-cell weui-cell_access"style="padding: 15px;">
            <div class="weui-cell__bd">
                <p class="fs07">意向等级</p>
                <input class="weui-input" type="text" id='picker' placeholder="请选择"/>
            </div>
            <div class="weui-cell__ft">
            </div>
        </i>
        <a class="weui-cell weui-cell_access" href="javascript:;" style="padding: 15px;">
            <div class="weui-cell__bd yxqy">
                <p class="fs07">意向区域</p>
                <input class="weui-input" id="start" type="text" placeholder="省、市、区/县">
            </div>
            <div class="weui-cell__ft">
            </div>
        </a>
    </div>
    <!--联系地址-->
    <div class="g-lxdz lxdz">
        <label>联系地址</label>
        <input  class="weui-input" id="contact_address" type="text" placeholder="省、市、区/县"/>
    </div>
    <div class="g-lxdz">
        <label>选择街道</label>
        <input  class="weui-input" id="street" type="text" placeholder=''/>
    </div>
    <div class="g-lxdz">
        <label>详情地址</label>
        <input  class="weui-input" id="address" type="text" placeholder='请输入详情地址'/>
    </div>
    <a class="u-sub" style="color: #ffffff;" href="submitsuccess.html">提交审核</a>
    <input name="lat" type="text" />
    <input name="lon" type="text" />
</div>
<!-- loading toast -->
<div id="loadingToast" style="display:none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast" style="opacity: 1; visibility: visible;">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">加载中...</p>
    </div>
</div>
<div id="container" tabindex="0"></div>
{js href="/static/wechat/jquery_weui/lib/jquery-2.1.4.js" /}
{js href="/static/wechat/jquery_weui/js/jquery-weui.min.js" /}
{js href="/static/wechat/jquery_weui/js/data-picker1.js" /}
{js href="/static/wechat/jquery_weui/js/city-picker.js" /}
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=9a8d0d7e358d9d80f7f61a1989ba35a0"></script>
<script>
    $(function () {
        //初始化地图
        mapObj = new AMap.Map('container',{
            resizeEnable: true,
            zoom: 15,
            //zoomEnable: false,	//禁止放大缩小
            //dragEnable: false,	//禁止拖动
            mapStyle:'fresh'
        });

        //监控用户位置
        mapObj.plugin('AMap.Geolocation', function () {
            geolocation = new AMap.Geolocation({
                enableHighAccuracy: true,//是否使用高精度定位，默认:true
                timeout: 30000,          //超过30秒后停止定位，默认：无穷大
                maximumAge: 0,           //定位结果缓存0毫秒，默认：0
                convert: true,           //自动偏移坐标，偏移后的坐标为高德坐标，默认：true
                showButton: true,        //显示定位按钮，默认：true
                buttonPosition: 'LB',    //定位按钮停靠位置，默认：'LB'，左下角
                buttonOffset: new AMap.Pixel(10,10),//定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
                showMarker: true,        //定位成功后在定位到的位置显示点标记，默认：true
                showCircle: false,        //定位成功后用圆圈表示定位精度范围，默认：true
                panToLocation: true,     //定位成功后将定位到的位置作为地图中心点，默认：true
                zoomToAccuracy:true,      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
                extensions:'base'
            });
            //markerOptions: window.my_dingdan,
            mapObj.addControl(geolocation);//开始监控
            AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息//onComplete
            AMap.event.addListener(geolocation, 'error', onError);      //返回定位出错信息
            $(".amap-geo").trigger("click");
        });

        $("#picker").picker({
            title: "请选择您的意向等级",
            cols: [
                {
                    textAlign: 'center',
                    values: ['省', '市', '区']
                }
            ]
        });

        $("#start").cityPicker({
            title: "选择意向区域",
            onChange: function (picker, values, displayValues) {
                var _picker = $("#picker").val();
                switch (_picker) {
                    case '省':
                        displayValues.splice(1,2);
                        break;
                    case '市':
                        displayValues.splice(2,1);
                        break;
                    default:
                        break;
                }
                $("#start").val(displayValues.join(" "));
            }
        });

        $("#contact_address").cityPicker({
            title: "选择联系地址",
            onChange: function (picker, values, displayValues) {
            }
        });
        var _is_contact_address = false;
        $("#contact_address").change(function () {
            _is_contact_address=true;
        });

        $(document).on('click', ".picker-button:first", function () {
            if (_is_contact_address) {
                var area = $("#contact_address").attr('data-code');
                $.get("{:url('wechat/base/get_street')}", {area: area}, function (msg) {
                    console.log(msg);
                });
            }
            _is_contact_address = false;
        });

        $("input[type='file']").change(function () {
            console.log($(this));
            console.log($(this)[0].files[0]);
            return false;
            $('#loadingToast').fadeIn();
            $('.weui-toast__content').html('正在上传...');
            var formData = new FormData();
            formData.append("type",type);
            formData.append("img",$("#uploaderInput")[0].files[0]);
            $.ajax({
                url: url,
                type: 'POST',
                data: formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                dataType:"json",
                success: function (d) {
                    if(!d.code){
                        alert(d.msg);
                    }else{
                        if (type == 'austin') {
                            $('input[name="img'+ ($(".tjimg img").length + 1) +'"]').val(d.data.path);
                            $('#uploaderInput').parent().before('<div class="scimg'+ ($(".tjimg img").length + 1) +' tjimg"> <img src="'+ d.data.path +'" /> </div>');
                        } else {
                            $(".tjimg").prepend('<img src="'+d.data+'" onclick="this.parentNode.removeChild(this)" />');
                        }
                    }
                    $('#loadingToast').fadeOut();
                },
                error: function (d) {
                    alert('网络异常');$('#loadingToast').fadeOut();
                }
            });
        });
    });

    //处理定位信息
    function onComplete(data){
        //point	Point	坐标点。
        //accuracy	Number	定位精确程度，单位为米。

        if(data.info=="SUCCESS"){
            $('input[name="lat"]').val(data.position.L);
            $('input[name="log"]').val(data.position.I);
        }
    }
    //处理定位出错信息
    function onError(e){
        alert("无法获取您的位置<br>请重新访问...<br>(" + e.message + ")");
        $('#loadingToast').fadeOut();

        //微信开发工具测试 170207
        var testObj = {"type":"complete","info":"SUCCESS","status":1,"l3":"jsonp_464548_","position":{"L":28.20703,"I":112.87022000000002,"lng":112.87022,"lat":28.20703},"message":"Get ipLocation success.Get address success.","location_type":"ip","accuracy":null,"isConverted":true,"addressComponent":{"citycode":"0731","adcode":"430104","businessAreas":[{"name":"麓谷","id":"430104","location":{"L":28.21402974876848,"I":112.88941027093597,"lng":112.88941,"lat":28.21403}}],"neighborhoodType":"","neighborhood":"","building":"","buildingType":"","street":"麓松路","streetNumber":"51号","province":"湖南省","city":"长沙市","district":"岳麓区","township":"麓谷街道"},"formattedAddress":"湖南省长沙市岳麓区麓谷街道延农创业大厦延农5期","roads":[],"crosses":[],"pois":[]};
        onComplete(testObj);

    }
</script>
</body>
</html>